package com.tanhua.dubbo.server.service;

import com.tanhua.dubbo.server.enums.IdType;
import org.omg.CORBA.IDLType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @author 86185
 * @version 1.0
 * @description: TODO
 * @date 2021/7/3 22:17
 */

@Service
public class IdService {

    @Autowired
    private RedisTemplate<String,String> redisTemplate;

    public Long createId(IdType idType){
        String idKey = "TANHUA_ID_" + idType.toString();
        return this.redisTemplate.opsForValue().increment(idKey);
    }
}
